package com.hua.api.modules.express.dao;

import com.hua.api.core.framework.statement.EntityManagerTemplate;
import com.hua.api.core.framework.statement.Statement;
import com.hua.api.core.framework.statement.mysql.StatementFactoryImpl;
import com.hua.api.modules.express.domain.ExpressOrder;
import org.springframework.stereotype.Repository;

@Repository
public class ExpressOrderDao extends EntityManagerTemplate {

    public ExpressOrder findByExpressOrderNo(String expressOrderNo) {
        Statement statement = StatementFactoryImpl.getInstance().createStatement(" from ExpressOrder eo where eo.expressOrderNo = ?1 ");
        statement.addParam(expressOrderNo);
        return findObject(statement, ExpressOrder.class);
    }

    public ExpressOrder findUseThirdOrderNo(String thirdOrderNo) {
        Statement statement = StatementFactoryImpl.getInstance().createStatement(" from ExpressOrder eo where eo.thirdOrderNo = ?1 ");
        statement.addParam(thirdOrderNo);
        return findObject(statement, ExpressOrder.class);
    }

}
